/**
 * User: sheyude
 * Date: 2017/9/29 0029
 * Time: 下午 20:24
 *
 */
import {MatIconRegistry} from '@angular/material'
import {DomSanitizer} from '@angular/platform-browser'

/**
 * svg 嵌入
 * @param {MatIconRegistry} ir
 * @param {DomSanitizer} ds
 */
export const loadSvgRegsources = (ir:MatIconRegistry,ds:DomSanitizer) =>{
  const imgDir = 'assets/image';
  const sidebarDir = `${imgDir}/sidebar`;

  const iconDir =`${imgDir}/icons`;

  ir.addSvgIcon('day',ds.bypassSecurityTrustResourceUrl(`${sidebarDir}/day.svg`));
  ir.addSvgIcon('month',ds.bypassSecurityTrustResourceUrl(`${sidebarDir}/month.svg`));
  ir.addSvgIcon('project',ds.bypassSecurityTrustResourceUrl(`${sidebarDir}/project.svg`));
  ir.addSvgIcon('projects',ds.bypassSecurityTrustResourceUrl(`${sidebarDir}/projects.svg`));
  ir.addSvgIcon('week',ds.bypassSecurityTrustResourceUrl(`${sidebarDir}/week.svg`));
  ir.addSvgIcon('move',ds.bypassSecurityTrustResourceUrl(`${iconDir}/move.svg`));


  // 头像
  const avatarDir = `${imgDir}/avatar`;
  ir.addSvgIconSetInNamespace('avatars',ds.bypassSecurityTrustResourceUrl(`${avatarDir}/avatars.svg`));
  ir.addSvgIcon('unassigned',ds.bypassSecurityTrustResourceUrl(`${avatarDir}/unassigned.svg`));



  // 可变日期
  const dayDir = `${imgDir}/days`;
  const days = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
  days.forEach(d => {
    ir.addSvgIcon(`day${d}`,ds.bypassSecurityTrustResourceUrl(`${dayDir}/day${d}.svg`));
  })
}
